<head>
	<!--
		=================================================================================================
		Copyright (c) 2012 Athena Health. 
		This software is the proprietary information of Athena Health
		All Right Reserved.
		Repository path:    $HeadURL: http://athena-call-routing.googlecode.com/svn/trunk/database.php $
		Last committed:     $Revision: 45 $
		Last changed by:    $Author: davidjmorin@gmail.com $
		Last changed date:    $Date: 2012-07-02 21:10:12 -0400 (Mon, 02 Jul 2012) $
		ID:            $Id: index.php 45 2012-07-03 01:10:12Z davidjmorin@gmail.com $
		=================================================================================================
	--> 
	<style type="text/css">
		body {background-color:#42520e;}
		th {background: URL(http://www.athenahealth.com/_img/boxes/carousel_bg.png);}
		p {color:blue;}
		table {
		table-layout:fixed
		width:400px;
		}
		td#key {
		width:25%;
		border:1px solid red;
		}
		td#bl {
		width:25%;
		border:1px solid red;
		}
		td#ph {
		width:50%;
		border:1px solid red;
		}
		td#reason {
		width:50%;
		border:1px solid red;
		}
	</style>
</head>

<?php
	
	$hostname = "localhost";
	$username = "root";
	$password = "123456";
	
	
	
	############## Make the mysql connection ###########
	try {
		$db = new PDO("mysql:host=$hostname;dbname=bbpinpal_article", $username, $password);		
		$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
		
		$block1 = "block 1";
		$block2 = "block 3";
		$block3 = "block 1";
		$i_d = $_POST['value'];
		
		////Inserts Search Data////////
		$sql = "INSERT INTO `keyword_athena` (`keyword`)
		VALUES('".$i_d."')";
		/////////END///////////////////
		
		////////This is the main table for keywords//////////
		
		$count = $db->exec($sql);
		$sql = "Select * from athena WHERE keyword LIKE '%" . $i_d . "%'  ";
		$result = $db->query($sql);
		echo "<table>";
		foreach ($result as $data) {
			echo ' 
			<tr style="background-color:#576c11;"> 
			<td id"key" style="font-size:18px; color:#f0cb01;">'.$data["keyword"].'</td> 
			<td id"bl" style="font-size:18px;color:#f0cb01;">'.$data["block"].'</td> 
			<td id"ph" style="font-size:18px;color:#f0cb01;">'.$data["phone"].'</td> 
			<td id"reason" style="font-size:18px;color:#f0cb01;">'.$data["Reason"].'</td>';
			
			if( $data['block'] == 'Block 1' || $data['block'] == 'Block 3' || $data['block'] == 'Block 4')   
			{  
				echo '<td style="font-size:18px;color:#f0cb01;"> ';
				echo '<a href="kickcodes.php?id='.$data["block"].'">Kickcodes</a>';      
				echo '<td><a href="ola.php?id=' . $data["block"] . '">OLA</a> ';
				echo '</td>';  
			}  
			else   
			{  
				echo "<td>";
				echo '<td><a href="ola.php?id=' . $data["block"] . '">OLA</a> ';
			}  
			echo '</td>';  
			
			
		}
		echo "</tr></table>";
		//echo 'entry succesfull';
		$db = null; // close the database connection
		
	}
	catch(PDOException $e) {
		echo $e->getMessage();
	}
	
	///////// END MAIN TABLE/////////////////////////	
?>

